import { defHttp } from '/@/utils/http/axios';
import {  WebsiteTrainEnrollModel, WebsiteTrainEnrollTableRecordModel } from '../model/websiteTrainEnrollModel';
import { ErrorMessageMode } from "/#/axios";

enum Api {
  WEBSITETRAINENROLL_PAGE = '/jxxhWebsite/websiteTrainEnroll/getTrainEnrollVosPage',
  GET_WEBSITETRAINENROLLVO_BY_ID = '/jxxhWebsite/websiteTrainEnroll/',
  WEBSITETRAINENROLLVO_SAVE = '/jxxhWebsite/websiteTrainEnroll/save',
  WEBSITETRAINENROLLVO_UPDATE = '/jxxhWebsite/websiteTrainEnroll/updateById',
  WEBSITETRAINENROLLVO_REMOVE = '/jxxhWebsite/websiteTrainEnroll/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteTrainEnrollListApi = (params: Object) =>
  defHttp.get<WebsiteTrainEnrollTableRecordModel>(
    {url: Api.WEBSITETRAINENROLL_PAGE,params },
    { errorMessageMode: 'message' }
  );

export const getWebsiteTrainEnrollVoByIdApi = (id) =>
  defHttp.get<WebsiteTrainEnrollModel>(
    {url: Api.GET_WEBSITETRAINENROLLVO_BY_ID+id },
    { errorMessageMode: 'message' }
  );

export function websiteTrainEnrollSaveApi(params: WebsiteTrainEnrollModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<WebsiteTrainEnrollModel>(
    {
      url: Api.WEBSITETRAINENROLLVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteTrainEnrollUpdateApi(params: WebsiteTrainEnrollModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.put<WebsiteTrainEnrollModel>(
    {
      url: Api.WEBSITETRAINENROLLVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteTrainEnrollModel>(
    {url: Api.WEBSITETRAINENROLLVO_REMOVE+id },
    { errorMessageMode: 'message' }
  );
